//
//  XMGCategoryCell.m
//  BuDeJie19
//
//  Created by hjj on 2016/12/3.
//  Copyright © 2016年 hjjuny. All rights reserved.
//
#import "XMGCategoryCell.h"
#import "XMGCategoryItem.h"
@interface XMGCategoryCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameView;
@property (weak, nonatomic) IBOutlet UIView *indicatorView;


@end

@implementation XMGCategoryCell

- (void)setCategory:(XMGCategoryItem *)category
{
    _category = category;
    
    _nameView.text = _category.name;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    // 取消选中样式
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
}

// 什么时候调用
// 当一个cell被选中的时候调用
// 当一个cell取消选中的时候也会调用
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    self.indicatorView.hidden = !selected;
    self.nameView.textColor = selected?[UIColor redColor]:[UIColor blackColor];
//    NSLog(@"%@ : %d",self,selected);
}

@end
